package com.woniu.map.service.impl;

import com.woniu.internalcommon.constant.CommonStatusEnum;
import com.woniu.internalcommon.dto.ResponseResult;
import com.woniu.map.remote.WeatherClient;
import com.woniu.map.service.WeatherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@Slf4j
public class WeatherServiceImpl implements WeatherService {

    @Autowired
    private WeatherClient weatherClient;

    /**
     * 取当前天气
     * @param city 城市编码
     * @return
     */

    @Override
    public List getWeather(String city, Boolean isForecast) {
        try {
            List weather = weatherClient.getWeather(city, isForecast);
            log.info("查询天气，结果：{}", weather);
            return weather;
        }catch (Exception e){

            log.error("查询天气异常：{}", e.getMessage());
            return null;
        }
    }




}
